//
// Created by longyunbo on 6/23/21.
//

#include "MethodInfo.h"

//设置属于谁的InstanKlass
InstanceKlass* MethodInfo::getBelongKlass(){
    return belongKlass;
};
void MethodInfo::setBelongKlass(InstanceKlass* value){
    belongKlass = value;
};

void MethodInfo::initAttributeContainer(){
    attributes = new CodeAttributeInfo[getattributesCount()];
}

void MethodInfo::setAccessFlag(AccessFlags* value){
    accessFlags = value;
};
AccessFlags* MethodInfo::getAccessFlag(){
    return accessFlags;
};

CodeAttributeInfo* MethodInfo::getCodeAttributeInfo(){
    return attributes;
};


CodeAttributeInfo MethodInfo::getCodeAttributeItemInfo( int value ){
    return attributes[value];
};

MethodInfo::~MethodInfo(){

    if( belongKlass == nullptr ){
        delete belongKlass;
    }
    if( accessFlags == nullptr ){
        delete accessFlags;
    }
    if( attributes == nullptr ){
        delete attributes;
    }

}


